#include<cstdio>
using namespace std;
int n,a[2000000]={-1},flag[2000000]={2},k,s[2000000];
int main()
{
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout);
	scanf("%d",&n);
	k=n;
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	while(k!=0)
	{
		for(int i=1;i<=n;i++)
		{
			if(flag[i]==1) continue;
			int x=i-1;
			while(flag[x]==1) x--;
			if(a[i]!=a[x]) 
			{
				printf("%d ",i);
				s[i]=1;
				k--;
			}
		}
		printf("\n");
		for(int i=1;i<=n;i++) if(s[i]==1) 
		{
			flag[i]=1;
			s[i]=0;
		}
	}
	return 0;
}
